home *** CD-ROM | disk | FTP | other *** search
- /*
- Nan.c
- This file declares a global constant, Nan, that represents a const double
- with the value nan("21"). Here's a typical use:
- x=Nan;
- "Nan" is defined in VideoToolbox.h as *(double *)__NAN. The virtue of this
- approach, rather than just computing a NAN, e.g. 0.0/0.0, is that it's faster.
- Secondly, there's bug in the THINK C Debugger (versions 6.01 through 7.03) on
- the PowerBook 170 that causes it to stop with a fatal error message when trying
- to compute 0.0/0.0 while Virtual Memory is enabled.
-
- This scheme should also work fine as native code on the PowerPC.
-
- HISTORY:
- 5/94 dgp wrote it.
- 7/29/94 dgp added support for Metrowerks CodeWarrior C compiler.
- 7/31/94 dgp changed code from 4 to 21.
- */
- #define code 21 // means "attempted to create a NaN with a zero code"
- #if (THINK_C || THINK_CPLUS)
- #if __option(double_8)
- const short __NAN[]={ 0x7FF0, code<<5, 0x0000, 0x0000 };
- #else
- #if !__option(native_fp)
- const short __NAN[]={ 0x7FFF, 0x7FFF, code, 0x0000, 0x0000, 0x0000 };
- #elif __option(mc68881)
- const short __NAN[]={ 0x7FFF, 0x0000, code, 0x0000, 0x0000, 0x0000 };
- #else
- const short __NAN[]={ 0x7FFF, code, 0x0000, 0x0000, 0x0000 };
- #endif
- #endif
- #endif
-
- #if __MWERKS__
- #if __ieeedoubles__
- const short __NAN[]={ 0x7FF0, code<<5, 0x0000, 0x0000 };
- #else
- #if __MC68881__
- const short __NAN[]={ 0x7FFF, 0x0000, code, 0x0000, 0x0000, 0x0000 };
- #else
- const short __NAN[]={ 0x7FFF, code, 0x0000, 0x0000, 0x0000 };
- #endif
- #endif
- #endif
-